import sectionTitle from '@/components/section-title';
	import Quote from "@/components/quote";
	import {
		fetchFriend
	} from '@/api'
	import {
		addFriendChain
	} from "@/api/friend.js"
	export default {
		name: "Friend",
		data() {
			return {
				list: [],
				friend: {
					name: ''
				},
				dialogFormVisible: false,
				friendChain: {
					name: "",
					href: "",
					describe: "",
					image: ""
				}
			}
		},
		components: {
			Quote,
			sectionTitle
		},
		methods: {
			addFriendChain() {
				this.dialogFormVisible = false;
				addFriendChain(this.friendChain).then(res => {
					this.$message({
						message: '申请成功',
						type: 'success'
					});
				})
			},
			fetchFriend() {
				fetchFriend().then(res => {
					this.list = res.data.data || []
				}).catch(err => {
					console.log(err)
				})
			},
		},
		mounted() {
			this.fetchFriend();
		},
		//页面创建之初自动触发的事件
		beforeCreate() {
			this.$bus.emit("setIdx", 2);
		}
	}